<#function useFile filePath fileName>
	<#switch fileName?keep_after_last('.')>
		<#case 'css'>
			<#return r'<link href="${site.resourcePath}'+filePath+'" rel="stylesheet"/>'/><#break>
		<#case 'js'>
			<#return r'<script src="${site.resourcePath}'+filePath+'"></script>'/><#break>
		<#case 'jpg'>
		<#case 'png'>
		<#case 'bmp'>
		<#case 'gif'>
			<#return r'<img src="${site.resourcePath}'+filePath+'"/>'/><#break>
		<#case 'ico'>
			<#return r'<link rel="shortcut icon" href="${site.resourcePath}'+filePath+'"/>'/><#break>
		<#case 'ogg'>
		<#case 'webm'>
		<#case 'mpeg'>
		<#case 'mpg'>
		<#case 'mov'>
		<#case 'rm'>
		<#case 'ram'>
		<#case 'avi'>
		<#case 'wmv'>
		<#case 'mp4'>
			<#return r'<video controls="controls"><source src="${site.resourcePath}'+filePath+'" type="video/${filePath?keep_after('.')}" />'/><#break>
		<#case 'wav'>
		<#case 'acc'>
		<#case 'mid'>
		<#case 'midi'>
		<#case 'wma'>
		<#case 'mpga'>
		<#case 'mp3'>
			<#return r'<video controls="controls"><source src="${site.resourcePath}'+filePath+'" type="video/${filePath?keep_after('.')}" />'/><#break>
		<#case 'rar'>
		<#case 'zip'>
		<#case 'html'>
			<#return r'<a href="${site.resourcePath}'+filePath+'">'+fileName+'</a>'/><#break>
		<#default>
			<#return r'${site.resourcePath}'+filePath/>
	</#switch>
</#function > 
<div class="pageContent">
	<table class="list" width="100%" layoutH="0">
		<thead>
			<tr>
				<th>使用</th>
				<th width="20"></th>
				<th>名称</th>
				<th>修改日期</th>
				<th>创建日期</th>
				<th>文件大小</th>
			</tr>
		</thead>
		<tbody>
	<@_resourceList path=path>
		<#if path?has_content>
			<tr>
				<td></td>
				<td class="tree"><div class="folder_expandable"></div></td>
				<td>
					<a href="cmsResource/lookup.html?path=${path?keep_before_last('/')}" target="dialog" mask="true" rel="cmsResourceLookup" title="${path?keep_before_last('/')}">
						..
					</a>
				</td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
			</tr>
		</#if>
		<#list list as a>
		<#assign filePath=path?has_content?then(path+'/','/')+a.fileName/>
			<tr>
				<td>
					<#if !a.directory>
						<a class="btnSelect" href="javascript:;" onclick="${editor!'cmsTemplateEditor'}.replaceSelection('${useFile(filePath,a.fileName)}');$.pdialog.closeCurrent();return false;" title="选择">选择</a>
					</#if>
				</td>
				<td class="tree"><div class="${a.directory?then('folder_expandable','file')}"></div></td>
				<td>
					<#if a.directory>
						<a href="cmsResource/lookup.html?path=${filePath}" target="dialog" mask="true" rel="cmsResourceLookup" title="${filePath}">
							${a.fileName}
						</a>
					<#else>
						${a.fileName}
					</#if>
				</td>
				<td>${a.lastModifiedTime?datetime}</td>
				<td>${a.creationTime?datetime}</td>
				<td><@t.fileSize a.size/></td>
			</tr>
		</#list>
	</@_resourceList>
		</tbody>
	</table>
</div>